package com.linewell.export.controller;

import com.linewell.export.service.IImportExcelService;
import com.linewell.export.service.IPbdBaseDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @Title: UserController
 * @description:
 * @author: pzhongqaing@linewell.com
 * @since: 2020年09月21日 20:23
 */
@Controller
public class ImportController {

    @Autowired
    private IPbdBaseDeviceService deviceService;

    @Autowired
    private IImportExcelService importExcelService;

    @RequestMapping("/import")
    @ResponseBody
    public boolean test(@RequestParam("file")MultipartFile file){
        List<String> list = importExcelService.importExcelWithSimple(file);
        return deviceService.updateByCode(list);
    }
}
